//
//  ADSEBLEManager.h
//  CoolCam
//
//  Created by lsq on 2023/3/16.
//  Copyright © 2023 JXW. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^connectBLEBlock)(BOOL success);

typedef void(^WiFiInfoBlock)(NSString *ssid, NSString *mac);

typedef void(^connectWiFiBlock)(BOOL success, NSString *ssid);

typedef void(^connectWiFiStartStatusBlock)(void);

typedef void(^scanDeviceBlock)(CBPeripheral *, NSDictionary *advertisementData, NSNumber *RSSI);

@interface ADSEBLEManager : NSObject

+ (ADSEBLEManager *)shareInstance;

// 蓝牙连接回调
@property (nonatomic, copy) connectBLEBlock connectBLEBlock;

// 获取WiFi信息回调
@property (nonatomic, copy) WiFiInfoBlock wifiInfoBlock;

// WiFi开始连接回调
@property (nonatomic, copy) connectWiFiStartStatusBlock connectWiFiStartStatusBlock;

// WiFi连接回调
@property (nonatomic, copy) connectWiFiBlock connectWiFiBlock;

// 扫描设备回调
@property (nonatomic, copy) scanDeviceBlock scanBlock;

// 蓝牙状态监听
@property (nonatomic, copy) void (^centralManagerStateBlock) (void);

// 当前连接的设备
@property (nonatomic, strong) CBPeripheral *peripheral;


// 开始搜索
- (void)startScan;

// 连接蓝牙设备
- (void)connectDeviceWithPeripheral:(CBPeripheral *)peripheral;

// 连接WiFi
- (void)connectWiFi;

// 获取蓝牙状态
- (CBManagerState)getManagerState API_AVAILABLE(ios(10.0));

// 停止扫描外设
- (void)stopScan;

@end

NS_ASSUME_NONNULL_END
